home *** CD-ROM | disk | FTP | other *** search
- package mochi.as3
- {
- import flash.display.MovieClip;
- import flash.text.TextField;
-
- public class MochiScores
- {
- private static var boardID:String;
-
- public static var onErrorHandler:Object;
-
- public static var onCloseHandler:Object;
-
- public function MochiScores()
- {
- super();
- }
-
- public static function _am523() : void
- {
- MochiServices.send("scores_closeLeaderboard");
- }
-
- public static function _ah51(param1:Object, param2:Object = null) : void
- {
- MochiServices.send("scores_getPlayerInfo",null,param1,param2);
- }
-
- public static function _lr251(param1:Object, param2:Object = null) : void
- {
- MochiServices.send("scores_requestList",null,param1,param2);
- }
-
- public static function _sh290(param1:Object = null) : void
- {
- if(param1 && param1.error == true && Boolean(onErrorHandler))
- {
- if(param1.errorCode == null)
- {
- param1.errorCode = "IOError";
- }
- onErrorHandler(param1.errorCode);
- MochiServices._gp767();
- return;
- }
- onCloseHandler();
- MochiServices._gp767();
- }
-
- public static function _ho215(param1:Object) : Object
- {
- var _loc2_:Object = null;
- var _loc3_:Number = NaN;
- var _loc4_:Number = NaN;
- var _loc5_:Object = null;
- var _loc6_:Object = null;
- var _loc7_:String = null;
- var _loc8_:String = null;
- _loc2_ = {};
- for(_loc7_ in param1)
- {
- if(typeof param1[_loc7_] == "object")
- {
- if(param1[_loc7_].cols != null && param1[_loc7_].rows != null)
- {
- _loc2_[_loc7_] = [];
- _loc5_ = param1[_loc7_];
- _loc4_ = 0;
- while(_loc4_ < _loc5_.rows.length)
- {
- _loc6_ = {};
- _loc3_ = 0;
- while(_loc3_ < _loc5_.cols.length)
- {
- _loc6_[_loc5_.cols[_loc3_]] = _loc5_.rows[_loc4_][_loc3_];
- _loc3_++;
- }
- _loc2_[_loc7_].push(_loc6_);
- _loc4_++;
- }
- }
- else
- {
- _loc2_[_loc7_] = {};
- for(_loc8_ in param1[_loc7_])
- {
- _loc2_[_loc7_][_loc8_] = param1[_loc7_][_loc8_];
- }
- }
- }
- else
- {
- _loc2_[_loc7_] = param1[_loc7_];
- }
- }
- return _loc2_;
- }
-
- public static function _jh790(param1:Number, param2:String, param3:Object = null, param4:Object = null) : void
- {
- param1 = Number(param1);
- if(isNaN(param1))
- {
- trace("ERROR: Submitted score \'" + String(param1) + "\' will be rejected, score is \'Not a Number\'");
- }
- else if(param1 == Number.NEGATIVE_INFINITY || param1 == Number.POSITIVE_INFINITY)
- {
- trace("ERROR: Submitted score \'" + String(param1) + "\' will be rejected, score is an infinite");
- }
- else
- {
- if(Math.floor(param1) != param1)
- {
- trace("WARNING: Submitted score \'" + String(param1) + "\' will be truncated");
- }
- param1 = Number(param1);
- }
- MochiServices.send("scores_submit",{
- "score":param1,
- "name":param2
- },param3,param4);
- }
-
- public static function _rh570(param1:Object = null) : void
- {
- var n:Number = NaN;
- var options:Object = param1;
- if(options != null)
- {
- delete options._cn696;
- MochiServices._hp652();
- MochiServices._ju656();
- if(options.name != null)
- {
- if(options.name is TextField)
- {
- if(options.name.text.length > 0)
- {
- options.name = options.name.text;
- }
- }
- }
- if(options.score != null)
- {
- if(options.score is TextField)
- {
- if(options.score.text.length > 0)
- {
- options.score = options.score.text;
- }
- }
- else if(options.score is MochiDigits)
- {
- options.score = options.score.value;
- }
- n = Number(options.score);
- if(isNaN(n))
- {
- trace("ERROR: Submitted score \'" + options.score + "\' will be rejected, score is \'Not a Number\'");
- }
- else if(n == Number.NEGATIVE_INFINITY || n == Number.POSITIVE_INFINITY)
- {
- trace("ERROR: Submitted score \'" + options.score + "\' will be rejected, score is an infinite");
- }
- else
- {
- if(Math.floor(n) != n)
- {
- trace("WARNING: Submitted score \'" + options.score + "\' will be truncated");
- }
- options.score = n;
- }
- }
- if(options.onDisplay != null)
- {
- options.onDisplay();
- }
- else if(MochiServices._cn696 != null)
- {
- if(MochiServices._cn696 is MovieClip)
- {
- MochiServices._cn696.stop();
- }
- else
- {
- trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
- }
- }
- }
- else
- {
- options = {};
- if(MochiServices._cn696 is MovieClip)
- {
- MochiServices._cn696.stop();
- }
- else
- {
- trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
- }
- }
- if(options._sh290 != null)
- {
- onCloseHandler = options._sh290;
- }
- else
- {
- onCloseHandler = function():void
- {
- if(MochiServices._cn696 is MovieClip)
- {
- MochiServices._cn696.play();
- }
- else
- {
- trace("Warning: Container is not a MovieClip, cannot call default onClose.");
- }
- };
- }
- if(options.onError != null)
- {
- onErrorHandler = options.onError;
- }
- else
- {
- onErrorHandler = null;
- }
- if(options.boardID == null)
- {
- if(MochiScores.boardID != null)
- {
- options.boardID = MochiScores.boardID;
- }
- }
- MochiServices._cl199(options.boardID,true);
- trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal");
- MochiServices.send("scores_showLeaderboard",{"options":options},null,_sh290);
- }
-
- public static function _no528(param1:String) : void
- {
- MochiServices._cl199(param1,true);
- MochiScores.boardID = param1;
- MochiServices.send("scores_setBoardID",{"boardID":param1});
- }
- }
- }
-
-